package com.cookor.poi.modules.phy.entity;

import com.cookor.poi.common.persistence.TreeEntity;
import com.cookor.poi.modules.tenant.entity.TTenant;
import com.fasterxml.jackson.annotation.JsonBackReference;
import org.hibernate.validator.constraints.Length;

public class TOffice extends TreeEntity<TOffice> {
  private static final long serialVersionUID = 1L;
  
  private Integer tenantId;
  
  private TOffice parent;
  
  private String parentIds;
  
  private String officeName;
  
  private TTenant tenant;
  
  private String tenantName;
  
  public TOffice() {}
  
  public TOffice(String id) {
    super(id);
  }
  
  public Integer getTenantId() {
    return this.tenantId;
  }
  
  public void setTenantId(Integer tenantId) {
    this.tenantId = tenantId;
  }
  
  @JsonBackReference
  public TOffice getParent() {
    return this.parent;
  }
  
  public void setParent(TOffice parent) {
    this.parent = parent;
  }
  
  @Length(min = 1, max = 2000, message = "所有父级编号长度必须介于 1 和 2000 之间")
  public String getParentIds() {
    return this.parentIds;
  }
  
  public void setParentIds(String parentIds) {
    this.parentIds = parentIds;
  }
  
  @Length(min = 0, max = 64, message = "科室名称长度必须介于 0 和 64 之间")
  public String getOfficeName() {
    return this.officeName;
  }
  
  public void setOfficeName(String officeName) {
    this.officeName = officeName;
  }
  
  public String getParentId() {
    return (this.parent != null && this.parent.getId() != null) ? this.parent.getId() : "0";
  }
  
  public TTenant getTenant() {
    return this.tenant;
  }
  
  public void setTenant(TTenant tenant) {
    this.tenant = tenant;
  }
  
  public String getTenantName() {
    return this.tenantName;
  }
  
  public void setTenantName(String tenantName) {
    this.tenantName = tenantName;
  }
}
